
<div class="container-fluid">
    <div class="wrapper">

        <div class="panel" id="nav">
            <div class="panel-heading"><h3 class="panel-title">批量导入备货需求</h3></div>
            <div class="panel-body">
    <form action="__URL__/create"  method="post" enctype="multipart/form-data" onsubmit="return check_data()" class="form-horizontal">

        <div class="form-group">
            <label  class="col-md-2">导入模板：</label>
            <div class="col-md-6 col-sm-10" style="cursor:pointer; ">
                <a id="download" class="icon-arrow-down">下载导入模板(支持xls,xlsx格式文件)</a>
            </div>
        </div>
        <div class="form-group">
            <label  class="col-md-2">中转仓</label>
            <div class="col-md-3 col-sm-10">
                <select class="chosen-select form-control" style="width: 100%" tabindex="-1" name="transfer_hopper_id"
                        data-name-group="common">
                    <option value="" class="empty-opt">-- 请选择 --</option>
                    <volist name="transfer" id="item">
                        <option value="{$item.id}" >{$item.name}</option>
                    </volist>
                </select>
            </div>
        </div>
            <div class="form-group">
            <label  class="col-md-2">导入:</label>
            <div class="col-md-3 col-sm-10">
                    <input class="btn" type="file"    name="file"  value="" style="width: 100%"  />
            </div>
            </div>
             <div class="form-group">
            <div class="col-md-offset-2 col-md-6">
                <input class="btn btn-success" type="submit" name="" value="导入" />
            </div>
        </div>
    </form>


    <div>
        <?php if(!empty($result)) echo $result;?>
    </div>
</div>
            </div>
        </div>
    </div>
<script>

    /**
     * @returns {boolean}
     * 表单提交验证
     */
    function check_data() {
        var transfer_hopper_id = $("select[name=transfer_hopper_id]").val();
        if(!transfer_hopper_id){
            alert('请选择中转仓');
            return false;
        }
        return true;
    }
    $("#download").click(function () {
        var fileName="FBA备货需求申请单导入模板";
        var list=new Array(["SKU"],["账号"],["站点"],["虚拟SKU"],["产品名称"],["需求数量"],["储位"],
                ["预拣数量"],["是否退税"],["公司主体（1有棵树电子商务有限公司，2杭州有棵树科技有限公司，3深圳市有棵树科技股份有限公司）"],
                ["销售员"],["采购员"],["要求到货日期"],["备注"]);
        var list1= new Array(["DEAP001"],["abc"],["US"],["ZH785403+abc+US"],
                ["爱他美奶粉1段"],["100"],[""],[""],["是"],
                ["深圳市有棵树科技股份有限公司"],["张三"],["李四"],["yyyy-mm-dd"],["示例"]);
        window.location.href ="Inbound/Prepareneeds/download?"+"&fileName="+fileName+"&list="+list+"&list1="+list1;
    });
</script>
